﻿using System.Drawing;
using System.Windows.Forms;

namespace ReportingApp
{
    public enum Status
    {
        TIDAK_HADIR = 0,
        HADIR = 1,
        TERLAMBAT = 2
    }

    public partial class AbsenDetail2 : UserControl
    {
        private Status _statusKehadiran;
        private string _nama;
        private string _jam;
        public AbsenDetail2()
        {
            InitializeComponent();
            StatusKehadiran = Status.TIDAK_HADIR;
        }

        public Status StatusKehadiran
        {
            get { return _statusKehadiran; }
            set
            {
                _statusKehadiran = value;
                if (_statusKehadiran == Status.TIDAK_HADIR)
                {
                    BackColor = Color.Red;
                    ForeColor = Color.White;
                }
                else if (_statusKehadiran == Status.HADIR)
                {
                    BackColor = Color.Green;
                    ForeColor = Color.White;
                }
                else
                {
                    BackColor = Color.Yellow;
                    ForeColor = Color.Black;
                }
            }
        }

        public string Nama
        {
            get { return _nama; }
            set { _nama = value; label1.Text = _nama; }
        }

        public string Jam
        {
            get { return _jam; }
            set { _jam = value; label2.Text = _jam; }
        }

        public Image Foto
        {
            get { return pictureBox1.BackgroundImage; }
            set { pictureBox1.BackgroundImage = value; }
        }
    }
}
